using System.ComponentModel.DataAnnotations.Schema;
using Jupiter.Infrastructure;

namespace Wips.Domain.Models.Authorities.Model
{
    /// <summary>
    /// 组织架构用户
    /// </summary>
    [Table("AuthorityOrganizationUsers")]
    [SugarTable("AuthorityOrganizationUsers")]
    public class OrganizationUser : ValueObjectBase
    {
        /// <summary>
        /// 组织架构ID
        /// </summary>
        public string OrganizationId { get; set; }

        /// <summary>
        /// 组织架构
        /// </summary>
        [Navigate(NavigateType.ManyToOne, nameof(OrganizationId))]
        public Organization Organization { get; set; }

        /// <summary>
        /// 用户ID
        /// </summary>
        public string UserId { get; set; }

        /// <summary>
        /// 用户
        /// </summary>
        [Navigate(NavigateType.ManyToOne, nameof(UserId))]
        public User User { get; set; }

        /// <summary>
        /// 
        /// </summary>
        public OrganizationUser()
        {
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="organizationId"></param>
        /// <param name="userId"></param>
        public OrganizationUser(string organizationId, string userId)
        {
            OrganizationId = organizationId;
            UserId = userId;
            Id = ObjectId.GenerateNewStringId();
        }
    }
}